workspace(name = "com_google_javascript_jscomp")

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

git_repository(
    name = "google_bazel_common",
    commit = "e388861b8ee72d805044967bb42b8f584ae629a8",
    remote = "git://github.com/google/bazel-common.git",
)

load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules", "maven_import")

google_common_workspace_rules()

maven_import(
    # http://args4j.kohsuke.org/index.html
    group_id = "args4j",
    artifact_id = "args4j",
    version = "2.0.26",
    sha256 = "989bda2321ea073a03686e9d4437ea4928c72c99f993f9ca6fab24615f0771a4",
    licenses = ["notice"],
)

maven_import(
    # https://github.com/google/gson
    group_id = "com.google.code.gson",
    artifact_id = "gson",
    version = "2.7",
    sha256 = "2d43eb5ea9e133d2ee2405cc14f5ee08951b8361302fdd93494a3a997b508d32",
    licenses = ["notice"],
)

maven_import(
    # https://github.com/protocolbuffers/protobuf
    group_id ="com.google.protobuf",
    artifact_id = "protobuf-java",
    version ="3.11.1",
    sha256 = "4a01db8277b79eaf84151013f3348a4d24720c8c9e1b33e5ed292caca5567cf1",
    licenses = ["notice"],
)

maven_import(
    # https://github.com/google/re2j
    group_id ="com.google.re2j",
    artifact_id = "re2j",
    version ="1.3",
    sha256 = "d8040fa1c54c1ce208199015b6e599ec2ef37b7780f8f55a8b4b4b4299bade19",
    licenses = ["notice"],
)

## Load J2CL repo ##

http_archive(
    name = "com_google_j2cl",
    strip_prefix = "j2cl-dc37ec4ce78e58258001cdef1af6387bf232f82e",
    url = "https://github.com/google/j2cl/archive/dc37ec4ce78e58258001cdef1af6387bf232f82e.zip",
    sha256 = "9b43896bba24602d83a08a9a1d660fc990830a90bdae556eeed6dfe1bbfa569a",
)

load("@com_google_j2cl//build_defs:repository.bzl", "load_j2cl_repo_deps")

load_j2cl_repo_deps()

load("@com_google_j2cl//build_defs:rules.bzl", "setup_j2cl_workspace", "j2cl_maven_import_external")

setup_j2cl_workspace()


## Load Elemental2 repo ##

http_archive(
    name = "com_google_jsinterop_generator",
    url = "https://github.com/google/jsinterop-generator/archive/5a7ea33bcfcac3f640604b822277d7090d54d101.zip",
    strip_prefix = "jsinterop-generator-5a7ea33bcfcac3f640604b822277d7090d54d101",
    sha256 = "d9ec405cc6177ff230660a64a7b182c6ffab580d2512980adb32dfa9a73a9885",
)

http_archive(
    name = "com_google_elemental2",
    strip_prefix = "elemental2-12b55c5fb798603201320d03206aa926508c3278",
    url = "https://github.com/google/elemental2/archive/12b55c5fb798603201320d03206aa926508c3278.zip",
    sha256 = "e5de4402ea7a034118d34019284be84b7002cbf06ad70722ea8a1e43657e98f7",
)


load("@com_google_elemental2//build_defs:repository.bzl", "load_elemental2_repo_deps")

load_elemental2_repo_deps()

load("@com_google_elemental2//build_defs:workspace.bzl", "setup_elemental2_workspace")

setup_elemental2_workspace()


## Load Maven dependencies ##

_MAVEN_CENTRAL_URLS = ["https://repo1.maven.org/maven2/"]

j2cl_maven_import_external(
    name = "org_checkerframework_checker_qual-j2cl",
    annotation_only = True,
    artifact = "org.checkerframework:checker-qual:2.5.3",
    artifact_sha256= "7be622bd25208ccfbb9b634af8bd37aef54368403a1fdce84d908078330a189d",
    server_urls = _MAVEN_CENTRAL_URLS,
)

j2cl_maven_import_external(
    name = "com_google_errorprone_error_prone_annotations-j2cl",
    annotation_only = True,
    artifact = "com.google.errorprone:error_prone_annotations:2.4.0",
    artifact_sha256= "5f2a0648230a662e8be049df308d583d7369f13af683e44ddf5829b6d741a228",
    server_urls = _MAVEN_CENTRAL_URLS,
)

j2cl_maven_import_external(
    name = "com_google_code_findbugs_jsr305-j2cl",
    annotation_only = True,
    artifact = "com.google.code.findbugs:jsr305:3.0.2",
    server_urls = _MAVEN_CENTRAL_URLS,
)

j2cl_maven_import_external(
    name = "com_google_j2objc_annotations-j2cl",
    annotation_only = True,
    artifact = "com.google.j2objc:j2objc-annotations:jar:1.3",
    artifact_sha256= "21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b",
    server_urls = _MAVEN_CENTRAL_URLS,
)

j2cl_maven_import_external(
    name = "com_google_guava-j2cl",
    artifact = "com.google.guava:guava-gwt:29.0-jre",
    artifact_sha256= "39e899acd9f9f09da2871eaaab0024cae2506da24457c9542955ed754f653292",
    server_urls = _MAVEN_CENTRAL_URLS,
    deps = [
        "@com_google_elemental2//:elemental2-promise-j2cl",
        "@com_google_errorprone_error_prone_annotations-j2cl",
        "@com_google_j2cl//:jsinterop-annotations-j2cl",
        "@com_google_j2objc_annotations-j2cl",
        "@org_checkerframework_checker_qual-j2cl",
    ],
)

j2cl_maven_import_external(
    name = "com_google_re2j-j2cl",
    artifact = "com.google.re2j:re2j:1.3",
    server_urls = _MAVEN_CENTRAL_URLS,
)

# Jarjar is a Google tool (https://github.com/google/jarjar) for generating
# shaded JARs (https://stackoverflow.com/questions/49810578). This repo contains
# Bazel bindings for Jarjar, under the Apache license.
git_repository(
    name = "com_github_johnynek_bazel_jar_jar",
    commit = "171f268569384c57c19474b04aebe574d85fde0d",
    remote = "git://github.com/johnynek/bazel_jar_jar.git",
)

load("@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl", "jar_jar_repositories")

jar_jar_repositories()
